/**
 * Created by Cindy on 2018/3/13.
 */
var url = "https://gitee.com/Cindy18SE";
var desc_ = "冯雪宁的码云";
function txweibo(){
    var _url = "https://gitee.com/Cindy18SE";
    var _showcount = 0;
    var _summary = "";
    var _title = desc_;
    var _site = "https://gitee.com/Cindy18SE";
    var _width = "600px";
    var _height = "800px";
//    var _pic = "http://www.junlenet.com/uploads/allimg/150510/1-150510104044.jpg";
    var _shareUrl = 'http://share.v.t.qq.com/index.php?c=share&a=index';
    _shareUrl += '&title=' + encodeURIComponent(_title||document.title);    //分享的标题
    _shareUrl += '&url=' + encodeURIComponent(_url||location.href);    //分享的链接
    _shareUrl += '&appkey=5bd32d6f1dff4725ba40338b233ff155';    //在腾迅微博平台创建应用获取微博AppKey
    //_shareUrl += '&site=' + encodeURIComponent(_site||'');   //分享来源
 //   _shareUrl += '&pic=' + encodeURIComponent(_pic||'');    //分享的图片，如果是多张图片，则定义var _pic='图片url1|图片url2|图片url3....'
    window.open(_shareUrl,'width='+_width+',height='+_height+',left='+(screen.width-_width)/2+',top='+(screen.height-_height)/2+',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');
}
var top = window.screen.height / 2 - 250;
var left = window.screen.width / 2 - 300;
var height = window.screen.height;
var width =  window.screen.width;
/*title是标题，rLink链接，summary内容，site分享来源，pic分享图片路径,分享到新浪微博*/
function sina() {
    var title = desc_;
    var   rLink = "https://gitee.com/Cindy18SE";
//    var backUrl = "http://wx.hengfu100.com/member/c_friend";
    var site = desc_;
//    var pic = "http://www.junlenet.com/uploads/allimg/150510/1-150510104044.jpg";
    window.open("http://service.weibo.com/share/share.php?pic=" +encodeURIComponent(pic) +"&title=" +
        encodeURIComponent(title.replace(/ /g, " ").replace(/<br \/>/g, " "))+ "&url=" + encodeURIComponent(rLink),
        "分享至新浪微博",
        "height=500,width=600,top=" + top + ",left=" + left + ",toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no");
}

function qqFriend() {
    var p = {
        url : 'https://gitee.com/Cindy18SE', /*获取URL，可加上来自分享到QQ标识，方便统计*/
        desc:'',
        //title : '新玩法，再不来你就out了！', /*分享标题(可选)*/
        title:desc_,
  //      summary : '', /*分享摘要(可选)*/
 //       pics : 'http://www.junlenet.com/uploads/allimg/150510/1-150510104044.jpg', /*分享图片(可选)*/
 //       flash : '', /*视频地址(可选)*/
 //       site : 'https://gitee.com/Cindy18SE', /*分享来源(可选) 如：QQ分享*/
//        style : '201',
//        width : 32,
//        height : 32
    };
    var width = "600px";
    var height = "800px";
    var s = [];
    for ( var i in p) {
        s.push(i + '=' + encodeURIComponent(p[i] || ''));
    }
    var shareUrl = "http://connect.qq.com/widget/shareqq/index.html?"+s.join('&');
//    return url;
    //window.location.href = url;
    //document.write(['<a class="qcShareQQDiv" href="http://connect.qq.com/widget/shareqq/index.html?',s.join('&'), '" >分享给QQ好友</a>' ].join(''));
    //window.open(_shareUrl,'width='+_width+',height='+_height+',top='+(screen.height-_height)/2+',left='+(screen.width-_width)/2+',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');
    window.open(shareUrl,'width='+width+',height='+height+',top='+(screen.height-height)/2+',left='+(screen.width-width)/2+',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');
}

function qzone(){
    var _url = "https://gitee.com/Cindy18SE";
    var _showcount = 0;
    var _desc = desc_;
    var _summary = "";
    var _title = "冯雪宁的码云";
//    var _site = "";
    var _width = "600px";
    var _height = "800px";
    var _summary = "";
//    var _pic = "http://www.junlenet.com/uploads/allimg/150510/1-150510104044.jpg";
    var _shareUrl = 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?';
    _shareUrl += 'url=' + encodeURIComponent(_url||document.location);   //参数url设置分享的内容链接|默认当前页location
    _shareUrl += '&showcount=' + _showcount||0;      //参数showcount是否显示分享总数,显示：'1'，不显示：'0'，默认不显示
    _shareUrl += '&desc=' + encodeURIComponent(_desc||'分享的描述');    //参数desc设置分享的描述，可选参数
    //_shareUrl += '&summary=' + encodeURIComponent(_summary||'分享摘要');    //参数summary设置分享摘要，可选参数
    _shareUrl += '&title=' + encodeURIComponent(_title||document.title);    //参数title设置分享标题，可选参数
    //_shareUrl += '&site=' + encodeURIComponent(_site||'');   //参数site设置分享来源，可选参数
 //   _shareUrl += '&pics=' + encodeURIComponent(_pic||'');   //参数pics设置分享图片的路径，多张图片以＂|＂隔开，可选参数
    window.open(_shareUrl,'width='+_width+',height='+_height+',top='+(screen.height-_height)/2+',left='+(screen.width-_width)/2+',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');
}
/*
$(function(){
   // var url = qqFriend();
    $("#qq_id").attr("href",qqFriend());
})*/

function tieba() {
    var tb = {
        shUrl:'https://gitee.com/Cindy18SE',
        shDesc:'',
        shTitle:desc_,
    };
    var tbWidth = "600px";
    var tbHeight = "800px";
    var tbS = [];
    for (var i in tb) {
        tbS.push(i + '='+ encodeURIComponent(tb[i] || ''));
    }
    var tbShareUrl = "http://tieba.baidu.com/f/commit/share/openShareApi?"+tbS.join('&');

   window.open(tbShareUrl,'width='+tbWidth+',height='+tbHeight+',top='+(screen.height-tbHeight)/2+',left='+(screen.width-tbWidth)/2+',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');
}